<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>


<body>
    <div id="test"></div>
</body>



<script type="text/javascript" src="../js/react.development.js"></script>
<script type="text/javascript" src="../js/react-dom.development.js"></script>
<script type="text/javascript" src="../js/babel.min.js"></script>
<script type="text/javascript" src="../js/prop-types.js"></script>

<script type="text/babel"> //必须声明 babel
    function Person(props) {
        return (
            <ul>
                <li>姓名:{props.name}</li>
                <li>年龄:{props.age + 1}</li>
                <li>性别:{props.sex}</li>
            </ul>
        )
    }
    Person.propTypes = {
        name: PropTypes.string.isRequired,
        age: PropTypes.number.isRequired,
        sex: PropTypes.string,
        spack: PropTypes.func
    }
    Person.defaultProps = {
        sex: '不男不女',
        age: 18
    }
    const p = {
        name: '张三',
        age: 19,
        // sex: '男',
    }
    // ReactDOM.render(<Person name='张三' age='18' sex='男' />, document.getElementById('test'))
    ReactDOM.render(<Person {...p} />, document.getElementById('test'))


    function spack() {
        console.log('说话了');
    }
</script>

</html>